<template>
  <div class="ind-org-rate">
    <el-button :type="(value === 0 && 'primary') || ''" size="mini" @click="changeStatus(0)">满意</el-button>
    <el-button :type="(value === 1 && 'primary') || ''" size="mini" @click="changeStatus(1)">基本满意</el-button>
    <el-button :type="(value === 2 && 'primary') || ''" size="mini" @click="changeStatus(2)">不满意</el-button>
  </div>
</template>

<script>
export default {
  name: 'IndOrgRate',
  components: {},
  model: {
    prop: 'value',
    event: 'changeValue',
  },
  props: {
    value: {
      type: [Number, String],
    },
  },
  data() {
    return {
      valueSelf: -1,
    }
  },
  computed: {},
  watch: {
    value(val) {
      if (val !== undefined) {
        this.valueSelf = Number(val)
      } else {
        this.valueSelf = -1
      }
    },
  },
  created() {
    if (this.value !== undefined) {
      this.valueSelf = Number(this.value)
    }
  },
  mounted() {},
  methods: {
    changeStatus(status) {
      this.valueSelf = status
      this.$emit('changeValue', status)
      this.$emit('change', status)
    },
  },
}
</script>
<style lang="scss" scoped>
.ind-org-rate {
}
</style>
